<template>
  <el-dialog
    width="100%"
    top="0px"
    :title="this.title"
     class="label_font"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="160px">

    <el-row  >
      <el-col :span="12"   >
            <el-form-item label="抵押权人名称" prop="dyqrmc" class="label_font" >
              <el-input v-model="dataForm.dyqrmc" placeholder="抵押权人名称"  style="100%"></el-input>
            </el-form-item>
      </el-col>

      <el-col :span="12">
          <el-form-item label="抵押权人类型" prop="dyqrlx" class="label_font">
            <el-select v-model="dataForm.dyqrlx" placeholder="抵押权人类型" style="width:100%" >
            </el-select>
          </el-form-item>
      </el-col>
    </el-row>

    <el-row>

      <el-col :span="12">
          <el-form-item label="抵押权人证件类型" prop="dyqrzjlx" class="label_font">
            <el-select v-model="dataForm.dyqrzjlx" placeholder="抵押权人证件类型" style="width:100%" >
            </el-select>
          </el-form-item>
      </el-col>

      <el-col :span="12">
            <el-form-item label="抵押权人证件号码" prop="dyqrzjhm" class="label_font" >
              <el-input v-model="dataForm.dyqrzjhm" placeholder="抵押权人证件号码"  style="100%"></el-input>
            </el-form-item>
      </el-col>

    </el-row>


    <el-row>
      <el-col :span="12">
          <el-form-item label="抵押人代理人名称" prop="dyrdlrmc" class="label_font">
            <el-input v-model="dataForm.dyrdlrmc" placeholder="抵押人代理人名称"></el-input>
          </el-form-item>
      </el-col>
      <el-col :span="12">
          <el-form-item label="抵押人代理人类型" prop="dyrdlrlx" class="label_font">
            <el-input v-model="dataForm.dyrdlrlx" placeholder="抵押人代理人类型"></el-input>
          </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
          <el-form-item label="抵押人代理人证件类型" prop="dyrdlrzjlx" class="label_font">
            <el-select v-model="dataForm.dyrdlrzjlx" placeholder="抵押人代理人证件类型" style="width:100%">
            </el-select>
          </el-form-item>
      </el-col>
      <el-col :span="12">
          <el-form-item label="抵押人代理人证件号码" prop="dyrdlrzjhm" class="label_font">
            <el-input v-model="dataForm.dyrdlrzjhm" placeholder="抵押人代理人证件号码"></el-input>
          </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
          <el-form-item label="不动产所属地市" prop="seRegion" class="label_font">
              <el-select  @change="selectChanged" v-model="dataForm.seRegion" 
                placeholder="不动产所属地市" style="width:100%">
              <el-option
                v-for="item in dataForm.seRegionList"
                :key="item.code"
                :label="item.name"
                :value="item.code">
              </el-option>
          </el-select>
          </el-form-item>
      </el-col>

      <el-col :span="12">
          <el-form-item label="不动产所属区县" prop="region" class="label_font">
            <el-select v-model="dataForm.region" placeholder="不动产所属区县" style="width:100%">
                <el-option
                  v-for="item in dataForm.regionList"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code">
                </el-option>
            </el-select>
          </el-form-item>
      </el-col>
    </el-row>
  

    <el-row>
      <el-col :span="12">
          <el-form-item label="代理人电话" prop="dlrdh" class="label_font">
            <el-input v-model="dataForm.dlrdh" placeholder="代理人电话"  ></el-input>
          </el-form-item>
      </el-col>
      <el-col :span="12">
          <el-form-item label="关联类型" prop="gllx" class="label_font">
            <el-select v-model="dataForm.gllx" placeholder="关联类型" style="width:100%">
            </el-select>
          </el-form-item>
      </el-col>
    </el-row>    

   
    <el-row>
      <el-col :span="12">
          <el-form-item label="合并编码" prop="babsm" class="label_font">
            <el-input v-model="dataForm.babsm" placeholder="合并编码"></el-input>
          </el-form-item>
      </el-col>
      <el-col :span="12">
          <el-form-item label="主债权担保金额(万元)" prop="dbje" class="label_font">
            <el-input v-model="dataForm.dbje" placeholder="主债权担保金额(万元)"></el-input>
          </el-form-item>
      </el-col>
    </el-row>

        <el-row>
      <el-col :span="12">
          <el-form-item label="债务人" prop="zwr" class="label_font">
            <el-input v-model="dataForm.zwr" placeholder="债务人"></el-input>
          </el-form-item>
      </el-col>
      <el-col :span="12">
          <el-form-item label="债务履行开始日期" prop="zwbegintime" class="label_font">
            <el-date-picker v-model="dataForm.zwbegintime" placeholder="债务履行开始日期"  format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width:100%" ></el-date-picker>
          </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
          <el-form-item label="债务履行开始日期" prop="zwendtime" class="label_font">
            <el-date-picker v-model="dataForm.zwendtime" placeholder="债务履行开始日期"  format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width:100%" ></el-date-picker>
          </el-form-item>
      </el-col>
        <el-col :span="12">
          <el-form-item label="预转本方式" prop="yzbfs" class="label_font">
            <el-select v-model="dataForm.yzbfs" placeholder="预转本方式" style="width:100%">
                <el-option
                  v-for="item in dataForm.regionList"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code">
                </el-option>
            </el-select>
          </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="办理点" prop="site" class="label_font">
          <el-select v-model="dataForm.site" placeholder="办理点" style="width:100%">
                <el-option
                  v-for="item in dataForm.siteList"
                  :key="item.siteno"
                  :label="item.sitename"
                  :value="item.siteno">
                </el-option>
            </el-select>
        </el-form-item>
      </el-col>

      <el-col :span="12">
        <el-form-item label="领证方式" prop="gettype" class="label_font">
             <el-select v-model="dataForm.gettype" placeholder="领证方式" style="width:100%">

            </el-select>
        </el-form-item>
      </el-col>

    </el-row>

        <el-row>

      <el-col :span="12">
        <el-form-item label="带过户抵押标识" prop="dyghbs" class="label_font">
             <el-select v-model="dataForm.dyghbs" placeholder="带过户抵押标识" style="width:100%">

            </el-select>
        </el-form-item>
      </el-col>
 
            <el-col :span="12">
                    <el-form-item label="抵押担保范围" prop="dbfw" class="label_font">
                        <el-input v-model="dataForm.dbfw" placeholder="抵押担保范围"></el-input>
                    </el-form-item>   
            </el-col>
   
    </el-row>

    <el-row  >
      <el-col :span="12">
          <el-row align="center" justify="center" >
              <el-col :span="24">

                  <div class="xwbl cell_border">抵押权人询问笔录</div>
              </el-col>
          </el-row>
          <el-row>
                <el-col :span="12" class="xwbl_item cell_border">是否为真实意思表示 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border">
                                 <el-radio-group v-model="dataForm.left1">
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>
                    <el-row>
                <el-col :span="12" class="xwbl_item cell_border">是否为共有房屋 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border">
                                 <el-radio-group v-model="dataForm.left2">
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>

          <el-row v-if="false">
                <el-col :span="12" class="xwbl_item cell_border_bottom">是否证件遗失 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border_bottom">
                                 <el-radio-group v-model="dataForm.left3">
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>
          <el-row v-if="false">
                <el-col :span="12" class="xwbl_item cell_border_bottom">是否证件一致 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border_bottom">
                                 <el-radio-group v-model="dataForm.left4">
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>
      </el-col>
      <el-col :span="12">
          <el-row>
              <el-col :span="24">

                  <div class="xwbl cell_border">抵押人询问笔录</div>
              </el-col>
          </el-row>
                    <el-row>
                <el-col :span="12" class="xwbl_item cell_border">是否为真实意思表示 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border">
                                 <el-radio-group v-model="dataForm.right1">
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>


           <el-row>
                <el-col :span="12" class="xwbl_item cell_border">是否为共有房屋 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border">
                <el-radio-group v-model="dataForm.right2">
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
                    </el-radio-group>
                </el-col>
          </el-row>

          <el-row v-if="false">
                <el-col :span="12" class="xwbl_item cell_border_bottom">是否证件遗失 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border_bottom">
            <el-radio-group v-model="dataForm.right3">
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>
          <el-row v-if="false">
                <el-col :span="12" class="xwbl_item cell_border_bottom">是否证件一致 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border_bottom">
                                 <el-radio-group v-model="dataForm.right4">
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>

      </el-col>
    </el-row>
    <el-row>
<el-col>
  <div>
    <table width='100%' border="1"  cellspacing="0">
                                        <tr>
                                            <td rowspan="7" align="center"><b>影像件:</b></td>
                                        </tr>
                                        <tr>

                                            <td>文件编码01：不动产抵押权登记申请书，需签字（签章） <font color="red"><b>*</b></font></td>
                                            <td>
                                                 <div style="width:300px;"></div>                                               
                                                <el-upload :action="url" 
                                                  ref="upload1"
                                                  :on-success="successHandle1"
                                                  :file-list="fileList1"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'01'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="handleRemove21"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary">点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码02：申请人身份证明材（买受人提供委托办理抵押权预告登记的公证委托书）） <font
                                                    color="red"><b>*</b></font></td>
                                            <td>
                                                                                                <el-upload :action="url" 
                                          
                                                  :on-success="successHandle2"
                                                  ref="upload2"
                                                  :file-list="fileList2"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'02'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="handleRemove22"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary">点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码03：抵押合同 <font color="red"><b>*</b></font></td>
                                            <td>
                                                                                                <el-upload :action="url" 
                                          
                                                  :on-success="successHandle3"
                                                  ref="upload3"
                                                  :file-list="fileList3"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'03'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="handleRemove23"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary">点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码04：主债权合同  <font color="red"><b>*</b></font></td>
                                            <td>

                                                  <el-upload :action="url" 
                                                  ref="upload4"
                                                  :on-success="successHandle4"
                                                  :file-list="fileList4"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'04'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="handleRemove24"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary">点击上传</el-button>
                                            </el-upload>

                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码06：当事人关于预告登记的约定<font color="red"><b>*</b></font>
                                            </td>
                                            <td>
                                                  <el-upload :action="url" 
                                                  ref="upload5"
                                                  :on-success="successHandle5"
                                                  :file-list="fileList5"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'05'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="handleRemove25"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary">点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码07：同意办理已销售房屋抵押登记的书面承诺（土地使用权已设立抵押的，抵押权人应提交）
                                            </td>
                                            <td>
                                            
                                            <el-upload :action="url" 
                                                  ref="upload6"
                                                  :on-success="successHandle6"
                                                  :file-list="fileList6"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'06'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="handleRemove26"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary">点击上传</el-button>
                                            </el-upload>
                                            
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码08：股东会或董事会决议（股份有限公司、有限责任公司应 提交）；上级主管部门批文（全民所有制企业应提交）；职工（代表）大会决议（集体所有制企业应提交）
                                            </td>
                                            <td>
                                            
                                            <el-upload :action="url" 
                                                  ref="upload6"
                                                  :on-success="successHandle6"
                                                  :file-list="fileList6"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'06'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="handleRemove26"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary">点击上传</el-button>
                                            </el-upload>
                                            
                                            </td>
                                        </tr>
                                    </table>
  </div>
                                    
  <div><font color="red">影像文件中带 * 的为必须上传的文件</font></div>  
         

</el-col>

    </el-row>


 <el-row>
          <el-col :span="24">
          <li v-for="(house,index) in this.dataForm.houseList" :key="index" style="width:100%;">
            不动产 - {{index+1}}
 
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="不动产所属区域"  class="label_font">
                        <el-input v-model="house.region" placeholder="不动产所属区域"></el-input>
                    </el-form-item>  
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="合同备案号"  class="label_font">
                        <el-input v-model="house.region" placeholder="合同备案号"></el-input>
                    </el-form-item>  
                  </el-col>
                  <el-col :span="8">
                        <el-form-item label="合同备案类型" prop="ctype" class="label_font">
                            <el-select v-model="dataForm.ctype" placeholder="合同备案类型" style="width:100%" >
                                <el-option
                                v-for="item in dataForm.contractTypeList"
                                :key="item.value"
                                :label="item.text"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="坐落"  class="label_font">
                        <el-input v-model="house.zl" placeholder="坐落"></el-input>
                    </el-form-item>  
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="面积"  class="label_font">
                        <el-input v-model="house.mj" placeholder="面积"></el-input>
                    </el-form-item>  
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="用途"  class="label_font">
                        <el-input v-model="house.purpose" placeholder="用途"></el-input>
                    </el-form-item>  
                  </el-col>
                </el-row>
           
          </li>

          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">

    <el-table
      :data="dyrList"
      border
      v-loading="dataListLoading"
      @selection-change="selectionChangeHandle"
      style="width: 100%;">

        <el-table-column
            prop="rymc"
            header-align="center"
            align="center"
            label="抵押人名称">
        </el-table-column>

        <el-table-column
            prop="rylxname"
            header-align="center"
            align="center"
            label="抵押人类型">
        </el-table-column>

        <el-table-column
            prop="zjlbname"
            header-align="center"
            align="center"
            label="抵押人证件类别">
        </el-table-column>

        <el-table-column
            prop="zjhm"
            header-align="center"
            align="center"
            label="抵押人证件号码">
        </el-table-column>

        </el-table>


          </el-col>
        </el-row>


    </el-form>
    <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="save()">信息保存</el-button> 
         <el-button type="primary" @click="downApply()">下载申请书</el-button>    
        <el-button type="primary" @click="submit()">提交</el-button>
      <el-button @click="visible = false">返回</el-button>

    </span>
  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        visible: false,
        url: '',
        title: '',
     
        fileList1: [],
        fileList2: [],
        fileList3: [],
        fileList4: [],
        fileList5: [],
        fileList6: [],
        dataListLoading: false,
        qlrList: [],
        ywrList: [],
        seqno: 0,
        step: 0,
        seRegion,
        region,

        dataForm: {
          seqno: 0,
          dyqrmc: '',
          dyqrlx: '',
          dyqrzjlx: '',
          dyqrzjhm: '',
          dyrdlrmc: '',
          region: '',
          seRegion: '',

          dyrdlrlx: '',
          dyrdlrzjlx: '',

          dyrdlrzjhm: '',
          dlrdh: '',
          gllx: '',

          babsm: '',
          dbje: '',

          zwr: '',
          rightagenttype: '个人',
          rightagentidtype: '身份证',
 
          zwbegintime: '',
          zwendtime: '',
          site: '',
          yzbfs: '',
          gettype: '',
          dyghbs: '',
          dbfw: '',

          left1: '',
          left2: '',
          left3: '',
          left4: '',    
          right1: '',
          right2: '',
          right3: '',
          right4: ''
        },
        dataRule: {
          
          site: [
            { required: true, message: '办理点不能为空', trigger: 'blur' }
          ],
          contractno: [
            { required: true, message: '合同备案号不能为空', trigger: 'blur' }
          ],
          ctype: [
            { required: true, message: '合同备案类型不能为空', trigger: 'blur' }
          ],
          seRegion: [
            { required: true, message: '不动产所属地市不能为空', trigger: 'blur' }
          ],
          region: [
            { required: true, message: '不动产所属区县不能为空', trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      init (id, step) {
        if (step == 0){
           this.dataForm.seqno = id
        }else{
          this.seqno = id
        }

        this.fileList1 = [];
        this.fileList2 = [];
        this.fileList3 = [];
        this.fileList4 = [];
        this.fileList5 = [];
        this.fileList6 = [];
  
        this.visible = true
        this.url = this.$http.adornUrl(`/bdc/bdcmortgregist/upload?token=${this.$cookie.get('token')}`)
        // this.dataForm.gettype = '电子证明';
        this.step = step;
        this.title = '预抵登记';
        if (step == 1){
           this.title = '预购商品房预告登记 （完善登记）';
        }else if (step == 2){
           this.title = '预购商品房预告登记 （重新提交）';
        }
        
        this.$http({
          url: this.$http.adornUrl(`/bdc/bdcnoticeregist/item/list`),
              method: 'get',
              params: this.$http.adornParams()
          }).then(({data}) => {
            if (data && data.code === 0) {
                this.dataForm.siteList = data.siteList
                this.dataForm.contractTypeList = data.contractTypeList
                this.dataForm.seRegionList = data.regionList
 
            }
        })

        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
      
            this.dataListLoading = true;
            if (step == 0){
              this.$http({
                url: this.$http.adornUrl(`/bdc/bdcmortgregist/info/${this.dataForm.seqno}`),
                method: 'get',
                params: this.$http.adornParams()
              }).then(({data}) => {
                if (data && data.code === 0) {

                  this.dataForm.seRegion = data.seRegionName
                  this.dataForm.region = data.regionName
                  this.seRegion = data.noticeRegister.seRegion
                  this.region = data.noticeRegister.region                  

                  this.dataForm.contractno = data.bdcContract.contractno
                  this.dataForm.ctype = data.bdcContract.ctype

                  this.dataForm.realtyunitno = data.realtyunitno
                  this.dataForm.fwyt = data.fwyt

                  this.qlrList = data.qlrList
                  this.ywrList = data.ywrList

                }
                this.dataListLoading = false;
              })
            }
            else{
                  this.$http({
                  url: this.$http.adornUrl(`/bdc/bdcnoticeregist/info/${this.seqno}`),
                  method: 'get',
                  params: this.$http.adornParams()
                }).then(({data}) => {
                  if (data && data.code === 0) {


                    this.dataForm.seRegion = data.noticeRegister.seRegion
                    this.dataForm.region = data.noticeRegister.region

                    this.dataForm.contractno = data.htba.HTBAH
                    this.dataForm.ctype = data.htba.HTLX

                    this.dataForm.realtyunitno = data.realtyunitno
                    this.dataForm.fwyt = data.fwyt

                    this.qlrList = data.qlrList
                    this.ywrList = data.ywrList

                    this.dataForm.babsm = data.noticeRegister.babsm
                    this.dataForm.site = data.noticeRegister.siteno

                    this.dataForm.rightagentname = data.qlrdlr.MC
                    this.dataForm.rightagentphone = data.qlrdlr.LXDH
                    this.dataForm.rightagentidcard = data.qlrdlr.ZJHM
                    this.dataForm.left1 = data.qlrXwbl.SFYYZS
                    this.dataForm.left2 = data.qlrXwbl.SFGY
                    this.dataForm.right1 = data.ywrXwbl.SFYYZS
                    this.dataForm.right2 = data.ywrXwbl.SFGY
                    this.dataForm.site = data.noticeRegister.bld

                    if (data.file01){
                      this.fileList1.push({'name':data.file01})
                    }
                    if (data.file02){
                      this.fileList2.push({'name':data.file02})
                    }
                    if (data.file03){
                      this.fileList3.push({'name':data.file03})
                    }
                    if (data.file04){
                      this.fileList4.push({'name':data.file04})
                    }
                    if (data.file05){
                      this.fileList5.push({'name':data.file05})
                    }
                    if (data.file06){
                      this.fileList6.push({'name':data.file06})
                    }

                  }
                  this.dataListLoading = false;
                })
            }
            
          
        })
      },

      selectChanged(value){
          this.dataForm.region = '';
          this.$http({
          url: this.$http.adornUrl(`/sys/bdcregion/listByLevle`),
              method: 'get',
              params: this.$http.adornParams({'upregion':value})
          }).then(({data}) => {
            if (data && data.code === 0) {
              this.dataForm.regionList = data.list
            }
        })
      },
            // 上传成功
      successHandle (response, file, callback) {

        if (response && response.code === 0) {
            this.$message({
              message: '上传文件成功',
              type: 'success',
              duration: 1500
            });
            if (!this.seqno){
              this.seqno = response.seqno
            }
            if (callback){
              callback();
            }
        } else {
          this.$message.error(response.msg)
        
        }
      },
      // 上传成功
      successHandle1 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
 
        })
        
      },
      successHandle2 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
   
        })
        
      },
      successHandle3 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
  
        })
        
      },
      successHandle4 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
          
        })
        
      },
      successHandle5 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
      
        })
        
      },
      successHandle6 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
    
        })
        
      },
      // 上传之前
      beforeUploadHandle (file) {
        
      },

      handleExceed(files, fileList) {
        this.$message.warning('只能上传一个文件');
      },
      beforeRemove(file, fileList) {
        return this.$confirm(`确定移除 ${ file.name }？`);
      },

      removeFile(file, fileList, filecode, callback){
          this.$http({
          url: this.$http.adornUrl(`/bdc/bdcnoticeregist/remove`),
              method: 'post',
              data: this.$http.adornData({
                'seqno': this.seqno,
                'fileCode': filecode
              })
          }).then(({data}) => {
            if (data && data.code === 0) {
               this.$message({
                  message: '删除成功',
                  type: 'success',
                  duration: 1500
                })
               if (callback){
                  callback();
               }
            }else{
              this.fileList = fileList
            }
        })
      },

      handleRemove21(file, fileList) {
        var self = this;
        this.removeFile(file, fileList, '01', function(){
            self.fileList1 = [];
        });
      },

      handleRemove22(file, fileList) {
        var self = this;
        this.removeFile(file, fileList, '02', function(){
            self.fileList1 = [];
        });
      },    

      handleRemove23(file, fileList) {
        var self = this;
        this.removeFile(file, fileList, '03', function(){
            self.fileList1 = [];
        });
      },

      handleRemove24(file, fileList) {
        var self = this;
        this.removeFile(file, fileList, '04', function(){
            self.fileList1 = [];
        });
      },

      handleRemove25(file, fileList) {
        var self = this;
        this.removeFile(file, fileList, '05', function(){
            self.fileList1 = [];
        });
      },

      handleRemove26(file, fileList) {
        var self = this;
        this.removeFile(file, fileList, '06', function(){
            self.fileList1 = [];
        });
      },

      downApply(){

      },

      submit(){
        this.save(true);
      },

      commit(path){

        var djry = [];
        if (this.dataForm.rightagentname){
          djry.push({
                    'TYPE': '10',
                    'RYLX': '1',
                    'ZJLB': '1',
                    'MC': this.dataForm.rightagentname,
                    'ZJHM': this.dataForm.rightagentidcard,
                    'LXDH': this.dataForm.rightagentphone
                });
        }

        this.$http({
              url: this.$http.adornUrl('/bdc/bdcnoticeregist/' + path),
              method: 'post',
              data: this.$http.adornData({
                'seqno': this.seqno,
                'bld': this.dataForm.site,
                'seRegion': this.dataForm.seRegion,
                'region': this.dataForm.region,
                'djryList':djry,
                'xwblList': [{
                  'TYPE': '01',
                  'SFYYZS': this.dataForm.left1,
                  'SFGY': this.dataForm.left2,
                  'SFZJYS': this.dataForm.left3,
                  'SFZJYZ': this.dataForm.left4,
                },
                {
                  'TYPE': '02',
                  'SFYYZS': this.dataForm.right1,
                  'SFGY': this.dataForm.right2,
                  'SFZJYS': this.dataForm.right3,
                  'SFZJYZ': this.dataForm.right4,
                }],
                'babsm': this.step == 0 ? '' : this.dataForm.babsm,
                'htbaseqno': this.dataForm.seqno
              })
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.$message({
                  message: '操作成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                    this.visible = false
                    this.$emit('refreshDataList')
                  }
                })
              } else {
                this.$message.error(data.msg)
              }
            })  
      },

      // 表单提交
      save (isSubmit) {

        if (isSubmit){
                if (this.dataForm.left1 == ''){
                  this.$message.error("请选择权利人询问笔录是否为真实意思表示")
                  return;
                }

                if (this.dataForm.left2 == ''){
                  this.$message.error("请选择权利人询问笔录是否为共有房屋")
                  return;
                }

                if (this.dataForm.right1 == ''){
                  this.$message.error("请选择义务人询问笔录是否为真实意思表示")
                  return;
                }

                if (this.dataForm.right2 == ''){
                  this.$message.error("请选择义务人询问笔录是否为共有房屋")
                  return;
                }

                var files = this.$refs.upload1.uploadFiles;
                if (files.length == 0){
                  this.$message.error("请上传文件编码01")
                  return;
                }

                if (this.$refs.upload2.uploadFiles.length == 0){
                  this.$message.error("请上传文件编码02")
                  return;
                }

                if (this.$refs.upload3.uploadFiles.length == 0){
                  this.$message.error("请上传文件编码03")
                  return;
                }

                if (this.$refs.upload4.uploadFiles.length == 0){
                  this.$message.error("请上传文件编码04")
                  return;
                }
        }

        if (isSubmit){
          this.$refs['dataForm'].validate((valid) => {
            if (valid) {
              this.commit('send');
            }
            else{
              this.$message.error("参数校验失败")
            }
          })
        }else{
          this.commit('save');
        }


        
      }
    }
  }
</script>
